import request from "@/utils/request";

// 查询商品信息列表
export function listGoods(query) {
  return request({
    url: "/system/goods/list",
    method: "get",
    params: query,
  });
}

// 查询商品信息详细
export function getGoods(id) {
  return request({
    url: "/system/goods/" + id,
    method: "get",
  });
}

// 新增商品信息
export function addGoods(data) {
  return request({
    url: "/system/goods/saveRecord",
    method: "post",
    data: data,
  });
}

// 修改商品信息
export function updateGoods(data) {
  return request({
    url: "/system/goods/saveRecord",
    method: "put",
    data: data,
  });
}

// 删除商品信息
export function delGoods(id) {
  return request({
    url: "/system/goods/" + id,
    method: "delete",
  });
}

// 上架下架
export function changePublicStatus(data) {
  return request({
    url: '/system/goods/changePublicStatus',
    method: 'post',
    data: data
  })
}

// 是否推荐
export function changeRecommendStatus(data) {
  return request({
    url: '/system/goods/changeRecommendStatus',
    method: 'post',
    data: data
  })
}

// 新增商品信息
export function saveRecord(data) {
  return request({
    url: '/system/goods/saveRecord',
    method: 'post',
    data: data
  })
}
